//
//  NEDRequestConfig.h
//  MoreCoin
//
//  Created by 林宁宁 on 2020/3/9.
//  Copyright © 2020 MoreCoin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <YTKNetwork/YTKBaseRequest.h>

NS_ASSUME_NONNULL_BEGIN

@class NEDRequestUploaBean;

@interface NEDRequestConfig<ResponseClass> : NSObject

@property (assign, nonatomic) YTKRequestSerializerType requestSerializerType;
@property (assign, nonatomic) YTKResponseSerializerType responseSerializerType;

/// 方式 default:YTKRequestMethodPOST
@property (assign, nonatomic) YTKRequestMethod method;

/// 请求地址域名 可设置域名或者完整地请求地址
@property (copy, nonatomic) NSString * _Nullable baseURL;

/// 请求地址， 请求地址默认拼接上domainURL
@property (copy, nonatomic) NSString * pathURL;

/// 参数
@property (retain, nonatomic) id argument;
/// 需要返回的的数据 类型 如果有则解析成该类型
/// 如果结果数据时数组类型 则自动解析成数组类型返回
@property (assign, nonatomic) ResponseClass responseClass;

/// 文件上传
/// 文件的路径信息 图片信息
@property (retain, nonatomic) NSArray <NEDRequestUploaBean *> *uploadFileBeans;


/// 超时 default:10
@property (assign, nonatomic) NSInteger timeout;

/// 显示加载提示框 default:YES
@property (assign, nonatomic) BOOL showLoading;
/// 显示成功的message
@property (assign, nonatomic) BOOL showMessageHUDSuccess;
/// 显示失败的message
@property (assign, nonatomic) BOOL showMessageHUDFail;

/// 请求失败 重试次数 默认0 使用Promise才执行
@property (assign, nonatomic) NSInteger retryTimes;
/// 请求失败 重试时间间隔 默认10s
@property (assign, nonatomic) NSInteger retryDelayInterval;

/// 自定义需要添加的请求头信息
@property (retain, nonatomic) NSDictionary * customHeaderField;

/// Debug 模式下打印请求结果信息
@property (assign, nonatomic) BOOL logResultData;

@end

/// 上传文件元素的信息
@interface NEDRequestUploaBean : NSObject

//三个文件类型设置一个就可以了
@property (copy, nonatomic) NSString * filePath;
@property (retain, nonatomic) UIImage * fileImage;
@property (retain, nonatomic) NSData * fileData;

@property (copy, nonatomic) NSString * fileName;
@property (copy, nonatomic) NSString * fileType;

@property (copy, nonatomic, readonly) NSString * fileNameUpload;

- (instancetype)initWithData:(id)data name:(NSString *)name type:(NSString * _Nullable)type;

@end

NS_ASSUME_NONNULL_END
